// import Vue from 'vue'
// import VueBus from 'vue-bus';
import './public-path.js'
import Test from './Test/Test.vue'
import ocr from './components/linpengDialog.vue'


let instance;
let propsObs = null;
function render(props={}) {
  propsObs = Vue.observable(props);//props观察化
  instance = new window.Vue({
    render: h => h(ocr,{props: propsObs}),
  }).$mount('#OCR_SELECTOR');
}

//独立启动
if (!window.__POWERED_BY_QIANKUN__) {
  new window.Vue({
    render: h => h(Test),
  }).$mount('#OCR_SELECTOR');
}

export async function bootstrap () {
  console.log('[vue] vue app bootstraped')
}

// 挂载
export async function mount (props) {
  render(props)
}

//更新 props
export async function update (props) {
  Object.assign(propsObs,props)
}

// 卸载
export async function unmount () {
  instance.$destroy()
  instance.$el.innerHTML = ''
  instance = null
}
